{literal}
<script type='text/javascript' language='javascript'>

{/literal}
	{$script}
{literal}

$("#lnkGerarCSV").click(function(){
	var params = $("#form_result").serialize();
	window.location.href = "relatorio/gerar-csv-contrato/?" + params;
});

</script>
{/literal}
{$mensagem}
{$corpo_html_extrato}

<div align="right" class="brod"><span id="lnkGerarCSV"><b>Exportar para</b> &nbsp;<img src="{$_site.url}/public/images/ic-xls.gif" border="0" align='top' style="cursor:pointer">&nbsp;</span></div>
<table width="100%" style="border:1px #AFAFAF solid" cellpadding="1" cellspacing="0">
  <tr>
  	<td colspan="2">
		<table width="100%" cellpadding="3" cellspacing="0">
			<tr>
				<td width="20%" bgcolor="#EBEFF0">
					<img src='{$_site.url}public/images/logo_extrato.gif' border='0' title='Alterar' width='150px'><br>
				</td>
				<td width="60%" align="center" class="bold terra zeta" bgcolor="#EBEFF0">
					RELAT&Oacute;RIO DE CONTRATOS
				</td>
				<td width="20%" align="right" bgcolor="#EBEFF0" class=" terra bold">
					Data: {$smarty.now|date_format:"%d/%m/%Y"}
				</td>
			</tr>
		</table>
	</td>
  </tr>
  <tr>
    <td width="100%" valign="top">
    <!--
		<fieldset>
		<legend><b>AGENDAMENTOS</b></legend>
		-->
		<div class="terra bold paddingBottom10">Contratos encontrados</div>
		<div align="right" class="brod">Num. registros (<b>{$num_contratos}</b>)</div>
		<form action="" name="form_result" id="form_result">
		<table width="100%" border="0" cellspacing="0" cellpadding="5" class="brod" style="border:1px #AFAFAF solid">
		<tr>
			<td width="30%" class=" bold" bgcolor="#E0ECEF" style="border-right:1px #AFAFAF solid; border-bottom:1px #AFAFAF solid;">Cliente</td>
			<td width="20%" class=" bold" bgcolor="#E0ECEF" style="border-right:1px #AFAFAF solid; border-bottom:1px #AFAFAF solid;">Status</td>
			<td width="20%" class=" bold" bgcolor="#E0ECEF" style="border-right:1px #AFAFAF solid; border-bottom:1px #AFAFAF solid;">
				{if $bln_statusatual == "1"}
					Data que entrou em Vigor <!-- Ativa&ccedil;&atilde;o -->
				{else}
					Data de in&iacute;cio do Status
				{/if}
			</td>
			<td width="20%" class=" bold" bgcolor="#E0ECEF" style="border-right:1px #AFAFAF solid; border-bottom:1px #AFAFAF solid;">Dt. Validade</td>
			<td width="10%" class=" bold" bgcolor="#E0ECEF" style="border-bottom:1px #AFAFAF solid;">Tipo Cliente</td>
		</tr>
        {assign var='bg1' value='#EBEFF0'}    
		{assign var='bg2' value=''}
		{assign var='i' value=1}
	    {foreach from=$contratos item=contrato key=k}
	    
	    {assign var='contrato_id' value=$contrato_id|cat:$contrato->id|cat:","} 
	    
	     {if $i++ is odd by 1} 
		   {assign var='bgcolor' value=$bg1} 
		{else} 
		   {assign var='bgcolor' value=$bg2} 
		{/if}
		<tr bgcolor="{$bgcolor}">
			<td style="border-left:0px #AFAFAF solid; border-right:1px #AFAFAF solid">({$contrato->id}) {$contrato->vhr_nome}</td>
			<td style="border-right:1px #AFAFAF solid">{if $bln_statusatual == "1"}{$contrato->int_statusatual|recuperarStatusContrato}{else}{$contrato->int_status|recuperarStatusContrato}{/if}</td>
			<td style="border-right:1px #AFAFAF solid">
			{if $bln_statusatual == "1"}
				{if $contrato->dte_assinatura != ""} {$contrato->dte_assinatura|ConverteData:5} {else} Contrato n&atilde;o iniciado{/if}
			{else}
				{if $contrato->dte_data != ""} {$contrato->dte_data|ConverteData:5} {else} Contrato n&atilde;o iniciado{/if}
			{/if}
			</td>
			<td style="border-right:1px #AFAFAF solid">{if $contrato->dte_validade != ""} {$contrato->dte_validade|ConverteData:5} {else} Contrato n&atilde;o iniciado{/if}</td>
			<td style="border-right:0px #AFAFAF solid">{if $contrato->bln_eventual == 1}Eventual{/if}{if $contrato->bln_eventual == 0}N&atilde;o Eventual{/if}</td>
		</tr>
		{foreachelse}
		<tr>
			<td colspan="5">Nenhum registro encontrado</td>
		</tr>
		{/foreach}
	    <input type="hidden" name="contratos_id" id="contratos_id" value="{$contrato_id}">
	    <input type="hidden" name="ordenacao" id="ordenacao" value="{$ordenacao}">
	    <input type="hidden" name="contrato_id" id="contrato_id" value="{$busca}">
	    <input type="hidden" name="statusatual" id="statusatual" value="{$bln_statusatual}">
	    <input type="hidden" name="busca_status" id="busca_status" value="{$busca_status}">
	    <input type="hidden" name="data_iniciostatus" id="data_iniciostatus" class="formulario" size="10" value="{$data_iniciostatus}">
		<input type="hidden" name="data_fimstatus" id="data_fimstatus" class="formulario" size="10" value="{$data_fimstatus}">
		<input type="hidden" name="data_inicioativacao" id="data_inicioativacao" class="formulario" size="10" value="{$data_inicioativacao}">
		<input type="hidden" name="data_fimativacao" id="data_fimativacao" class="formulario" size="10" value="{$data_fimativacao}">
		<input type="hidden" name="data_iniciovalidade" id="data_iniciovalidade" class="formulario" size="10" value="{$data_iniciovalidade}">
		<input type="hidden" name="data_fimvalidade" id="data_fimvalidade" class="formulario" size="10" value="{$data_fimvalidade}">
	    <input type="hidden" name="eventual" id="eventual" value="{$eventual}">
		</table>
		</form>
	 </td>
  </tr>
</table>